package com.xyg.product.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.xyg.common.model.BaseEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name="xyg_product_propertyvalue")
public class PropertyValue extends BaseEntity<PropertyValue, Long> {
	
	private String name;
	
	@ManyToOne(fetch=FetchType.LAZY)
	private Property property;
	
	@ManyToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private List<Template> templates = new ArrayList<>();
	
	@ManyToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private Set<Product> products = new HashSet<>();
	
	@ManyToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private Set<Goods> goods = new HashSet<>();
}
